home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / amiga-e / examples / showhide.e < prev    next >
Text File  |  1999-09-13  |  3KB  |  103 lines

  1. /*
  2. **  Original C Code written by Stefan Stuntz
  3. **
  4. **  Translation into E by Klaus Becker
  5. **
  6. **  All comments are from the C-Source
  7. */
  8.  
  9. /*
  10. ** The ShowHide demo shows how to hide and show objects.
  11. */
  12.  
  13. OPT PREPROCESS
  14.  
  15. MODULE 'utility/tagitem'
  16. MODULE 'libraries/gadtools'
  17. MODULE 'muimaster','libraries/mui','libraries/muip',
  18.        'mui/muicustomclass','amigalib/boopsi',
  19.        'intuition/classes','intuition/classusr',
  20.        'intuition/screens','intuition/intuition'
  21.  
  22. PROC main() HANDLE
  23.   DEF app,window,sigs=0,cm1,cm2,cm3,cm4,cm5,bt1,bt2,bt3,bt4,bt5
  24.  
  25.   IF (muimasterbase:=OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN))=NIL THEN
  26.     Raise('Failed to open muimaster.library')
  27.  
  28.   app := ApplicationObject,
  29.     MUIA_Application_Title      , 'ShowHide',
  30.     MUIA_Application_Version    , '$VER: ShowHide 13.56 (30.01.96)',
  31.     MUIA_Application_Copyright  , 'c1992/93, Stefan Stuntz',
  32.     MUIA_Application_Author     , 'Stefan Stuntz & Klaus Becker',
  33.     MUIA_Application_Description, 'Show object hiding.',
  34.     MUIA_Application_Base       , 'SHOWHIDE',
  35.     SubWindow, window := WindowObject,
  36.       MUIA_Window_Title, 'Show & Hide',
  37.       MUIA_Window_ID   , "SHHD",
  38.       WindowContents, HGroup, 
  39.         Child, VGroup, GroupFrame,
  40.           Child, HGroup, MUIA_Weight, 0,
  41.             Child, cm1 := CheckMark(MUI_TRUE),
  42.             Child, cm2 := CheckMark(MUI_TRUE),
  43.             Child, cm3 := CheckMark(MUI_TRUE),
  44.             Child, cm4 := CheckMark(MUI_TRUE),
  45.             Child, cm5 := CheckMark(MUI_TRUE),
  46.           End,
  47.           Child, VGroup, 
  48.             Child, bt1 := SimpleButton('Button 1'),
  49.             Child, bt2 := SimpleButton('Button 2'),
  50.             Child, bt3 := SimpleButton('Button 3'),
  51.             Child, bt4 := SimpleButton('Button 4'),
  52.             Child, bt5 := SimpleButton('Button 5'),
  53.             Child, VSpace(0),
  54.           End,
  55.         End,
  56.       End,
  57.     End,
  58.   End
  59.  
  60.   IF (app=NIL) THEN
  61.     Raise('Failed to create Application.')
  62.  
  63. /*
  64. ** Install notification events...
  65. */
  66.  
  67.   doMethodA(window,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,
  68.     app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit])
  69.  
  70.   doMethodA(cm1,[MUIM_Notify,MUIA_Selected,MUIV_EveryTime,bt1,3,MUIM_Set,MUIA_ShowMe,MUIV_TriggerValue])
  71.   doMethodA(cm2,[MUIM_Notify,MUIA_Selected,MUIV_EveryTime,bt2,3,MUIM_Set,MUIA_ShowMe,MUIV_TriggerValue])
  72.   doMethodA(cm3,[MUIM_Notify,MUIA_Selected,MUIV_EveryTime,bt3,3,MUIM_Set,MUIA_ShowMe,MUIV_TriggerValue])
  73.   doMethodA(cm4,[MUIM_Notify,MUIA_Selected,MUIV_EveryTime,bt4,3,MUIM_Set,MUIA_ShowMe,MUIV_TriggerValue])
  74.   doMethodA(cm5,[MUIM_Notify,MUIA_Selected,MUIV_EveryTime,bt5,3,MUIM_Set,MUIA_ShowMe,MUIV_TriggerValue])
  75.  
  76.   set(cm3,MUIA_Selected,FALSE)
  77.  
  78. /*
  79. ** This is the ideal input loop for an object oriented MUI application.
  80. ** Everything is encapsulated in classes, no return ids need to be used,
  81. ** we just check if the program shall terminate.
  82. ** Note that MUIM_Application_NewInput expects sigs to contain the result
  83. ** from Wait() (or 0). This makes the input loop significantly faster.
  84. */
  85.  
  86.   set(window,MUIA_Window_Open,MUI_TRUE)
  87.  
  88.   WHILE (doMethodA(app,[MUIM_Application_NewInput,{sigs}]) <> MUIV_Application_ReturnID_Quit)
  89.     IF (sigs) THEN sigs:=Wait(sigs)
  90.   ENDWHILE
  91.  
  92.   set(window,MUIA_Window_Open,FALSE)
  93.  
  94. /*
  95. ** Shut down...
  96. */
  97.  
  98. EXCEPT DO
  99.   IF app THEN Mui_DisposeObject(app)
  100.   IF muimasterbase THEN CloseLibrary(muimasterbase)
  101.   IF exception THEN WriteF('\s\n',exception)
  102. ENDPROC
  103.